import React, { useEffect } from 'react'
import { useParams, useSearchParams, useLocation } from 'react-router-dom'

export default function Home() {
    // const { id, title } = useParams()
    // const [serch, setSerch] = useSearchParams()
    const { state: { id, title } } = useLocation()

    // console.log(location);
    useEffect(() => {
    }, [])
    return (
        <div>我是HOme组件
            <ul>
                <div>
                    {/* 我是App的params参数， id: {id} title: {title} */}
                    {/* 我是App的query参数， id{serch.get('id')} title{serch.get('title')}
                    <button onClick={() => { setSerch('id=2&title=李四') }}>更改</button> */}
                    我是state参数id: {id} title: {title}
                </div>
            </ul>
        </div>
    )
}
